home *** CD-ROM | disk | FTP | other *** search
/ Teach Your Children: Road Construction Ahead / Teach Your Children: Road Construction Ahead.iso / pc / rca / road.dxr / 00005_LevelData Parent.ls < prev    next >
Encoding:
Text File  |  1996-07-17  |  2.1 KB  |  83 lines

  1. property booleanList, bmapList, unchecked, level, newLevel, firstLevelButton, soundList
  2. global gVTLgameObject, gSimObject
  3.  
  4. on birth me
  5.   set booleanList to [1, 0, 0]
  6.   set bmapList to [the number of cast "Rookie", the number of cast "Jr.Foreman", the number of cast "Foreman"]
  7.   set unchecked to the number of cast "uncheckedBox"
  8.   set firstLevelButton to 45
  9.   set level to 1
  10.   set newLevel to 1
  11.   set soundList to ["RookieSound", "Jr.ForemanSound", "ForemanSound"]
  12.   return me
  13. end
  14.  
  15. on redrawLevelButtons me, option
  16.   repeat with x = 1 to count(booleanList)
  17.     if x = option then
  18.       set the castNum of sprite (firstLevelButton + x - 1) to unchecked + 1
  19.       setAt(booleanList, x, 1)
  20.       next repeat
  21.     end if
  22.     set the castNum of sprite (firstLevelButton + x - 1) to unchecked
  23.     setAt(booleanList, x, 0)
  24.   end repeat
  25.   updateStage()
  26. end
  27.  
  28. on predrawLevelButtons me
  29.   repeat with x = 1 to count(booleanList)
  30.     set channel to firstLevelButton + x - 1
  31.     set the locH of sprite channel to the locH of sprite channel + 1000
  32.     set the castNum of sprite channel to unchecked + getAt(booleanList, x)
  33.     puppetSprite(channel, 1)
  34.   end repeat
  35. end
  36.  
  37. on puppetLevelButtons me
  38.   repeat with x = 1 to count(booleanList)
  39.     set channel to firstLevelButton + x - 1
  40.     puppetSprite(channel, 1)
  41.   end repeat
  42. end
  43.  
  44. on unPuppetLevelButtons me
  45.   repeat with x = 1 to count(booleanList)
  46.     puppetSprite(firstLevelButton + x - 1, 0)
  47.   end repeat
  48. end
  49.  
  50. on resetLevel me, newLevel
  51.   set level to newLevel
  52.   set booleanList to [0, 0, 0]
  53.   setAt(booleanList, level, 1)
  54. end
  55.  
  56. on goToNewLevel me
  57.   set the finishedFlag of gSimObject to 1
  58.   changeGridSize(me)
  59.   set level to newLevel
  60.   newVTLgame(gVTLgameObject)
  61. end
  62.  
  63. on changeGridSize me
  64.   if (newLevel = 1) and (level > 1) then
  65.     set the gridSize of gSimObject to "Large"
  66.     initSizeVariables(gSimObject)
  67.   else
  68.     if (newLevel > 1) and (level = 1) then
  69.       set the gridSize of gSimObject to "Small"
  70.       initSizeVariables(gSimObject)
  71.     end if
  72.   end if
  73. end
  74.  
  75. on playLevelSound me, whichLevel
  76.   set soundName to getAt(soundList, whichLevel)
  77.   puppetSound(soundName)
  78.   updateStage()
  79.   repeat while soundBusy(1)
  80.   end repeat
  81.   puppetSound(0)
  82. end
  83.